package net.zoneland.zrdp.system.service.mapstruct;


import net.zoneland.zrdp.common.core.domain.entity.SysUser;

import net.zoneland.zrdp.system.domain.bean.LoginedUser;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.factory.Mappers;

@Mapper
public interface UserConverter {
    UserConverter INSTANCE = Mappers.getMapper(UserConverter.class);

    @Mapping(target = "nickName", source = "userName")
    @Mapping(target = "phoneNumber", source = "mobilePhone")
    @Mapping(target = "userName", source = "uid")
    @Mapping(target = "companyDN", source = "companyDn")
    SysUser loginedUserToSysUser(final LoginedUser loginedUser);

    @Mapping(target = "nickName", source = "userName")
    @Mapping(target = "phoneNumber", source = "mobilePhone")
    @Mapping(target = "userName", source = "uid")
    @Mapping(target = "companyDN", source = "companyDn")
    void updateUserFromLoginedUser(LoginedUser loginedUserInfo, @MappingTarget SysUser dbuser);
}
